home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 4_7.lha / 4_7 / 4_7c.c < prev    next >
Text File  |  1993-08-08  |  569b  |  27 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <tnode.h>
  6. include <stream.h>
  7. / print a node's value and reference count,
  8. / indented by the depth, followed by the
  9. / left and right subtrees
  10. tatic void prnode(tnode *leaf, int level)
  11.  
  12.    if (leaf)
  13. {
  14. cout << str("", level) << leaf->tword << " " <<
  15.     leaf->count << "\n";
  16. prnode(leaf->left, level+1);
  17. prnode(leaf->right, level+1);
  18. }
  19.  
  20.  
  21. / print out the tree
  22. oid printtree(tree treeheadptr)
  23.  
  24.    prnode(*treeheadptr, 0);
  25.  
  26.  
  27.